package tcl.loan.system.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import tcl.loan.system.entity.User;
import tcl.loan.system.mapper.UserMapper;

import tcl.loan.system.utls.UserUtils;

/**
 * Created by linjianding on 2016/12/7.
 */
@Component
public class AccountService {
    public static final String HASH_ALGORITHM = "SHA-1";
    public static final int HASH_INTERATIONS = 1024;
    public static final int SALT_SIZE = 8;

    private static Logger logger = LoggerFactory.getLogger(AccountService.class);
   @Autowired
   private UserMapper userMapper ;
    public User getUserById(String id) {
       return userMapper.selectById(id);
    }

    public void updateUser(User user) {
       userMapper.updateById(user);
    }

    public User authentication(String username,String password)
    {

       User user=new User();
       user.setUserName(username);
      user.setUserPassword(password);
        return  userMapper.selectOne(user);
    }
}
